﻿<UserControl x:Class="NthDownload.Views.QueueDetailsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:behaviors="clr-namespace:NthDownload.Common.Interactivity.Behaviors;assembly=NthDownload.Common"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"             
             HorizontalAlignment="Center">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Row="0" Text="Name" Style="{StaticResource Label}" Margin="0,0,5,0"/>
        <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Queue.Name}" Style="{StaticResource MediumTextBox}">
            <i:Interaction.Behaviors>
                <behaviors:FocusOnLoad />
            </i:Interaction.Behaviors>
        </TextBox>

        <TextBlock Grid.Row="1" Text="Max Running Downloads" Style="{StaticResource Label}" Margin="0,5,5,0"/>
        <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Queue.MaxRunningDownloads}" Style="{StaticResource MediumTextBox}" Margin="0,5,0,0" />

        <TextBlock Grid.Row="2" Text="Max Retries" Style="{StaticResource Label}" Margin="0,5,5,0"/>
        <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Queue.MaxRetries}" Style="{StaticResource MediumTextBox}" Margin="0,5,0,0" />

        <TextBlock Grid.Row="3" Text="Max Threads" Style="{StaticResource Label}" Margin="0,5,5,0"/>
        <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Queue.MaxThreads}" Style="{StaticResource MediumTextBox}" Margin="0,5,0,0" />

        <TextBlock Grid.Row="4" Text="Bandwidth Provider" Style="{StaticResource Label}" Margin="0,5,5,0"/>
        <ComboBox Grid.Row="4" Grid.Column="1" Margin="0,5,0,0" ItemsSource="{Binding BandwidthProviders}"
                  DisplayMemberPath="Name" SelectedItem="{Binding Queue.BandwidthProvider, Converter={StaticResource BandwidthProviderNoneSelectionToNull}}" />

        <CheckBox Grid.Row="5" Grid.Column="1" IsChecked="{Binding Queue.StartDownloadsImmediately}" 
                  Content="Start Downloads Immediately"
                  Margin="0,5,0,0" />

        <StackPanel Grid.Row="6" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,5,0,0">
            <Button x:Name="Save" Content="Save" Margin="5,0,0,0" />
            <Button x:Name="Cancel" Content="Cancel" Margin="5,0,0,0" />
        </StackPanel>
    </Grid>
</UserControl>
